import Home from '@/components/layout/Home'
import Index from '@/components/views/Index'
import store from "@/store"

let login = resolve => require(['@/components/pages/Login'], resolve)
let index = resolve => require(['@/components/views/Index'], resolve)
// const login = () => import('@/components/pages/Login')
let NotFound = () => import('@/components/pages/NotFound')
let userInfo = resolve => require(['@/components/views/Userinfo'], resolve)
let E404 = () => import('@/components/pages/E404')
let vod = resolve => require(['@/views/sys/vod.vue'], resolve)
let livevideo = resolve => require(['@/views/sys/livevideo.vue'], resolve)
let main = resolve => require(['@/views/sys/hello'], resolve)
let history = resolve => require(['@/views/sys/history'], resolve)
let notFound = resolve => require(['@/views/404'], resolve)
let organizationManage = resolve => require(['@/views/sys/organizationManage'], resolve)
let userManage = resolve => require(['@/views/sys/userManage'], resolve)
let role = resolve => require(['@/views/sys/role'], resolve)
let roleassign = resolve => require(['@/views/sys/roleassign'], resolve)
let resource = resolve => require(['@/views/sys/resource'], resolve)
let logs = resolve => require(['@/views/sys/logs'], resolve)
let statisticsUser = resolve => require(['@/views/sys/statisticsUser'], resolve)
let statisticsVideo = resolve => require(['@/views/sys/statisticsVideo'], resolve)
let statisticsLive = resolve => require(['@/views/sys/statisticsLive'], resolve)
let statisticsOrg = resolve => require(['@/views/sys/statisticsOrg'], resolve)
let statisticsStore = resolve => require(['@/views/sys/statisticsStore'], resolve)
let bulletin = resolve => require(['@/views/sys/bulletin'], resolve)
let userM = resolve => require(['@/views/sys/userM'], resolve)
let dept = resolve => require(['@/views/sys/dept'], resolve)
let liveManage = resolve => require(['@/views/sys/liveManage'], resolve)
let vodManage = resolve => require(['@/views/sys/vodManage'], resolve)
let echarts = resolve => require(['@/views/echarts'], resolve)
let flowchat = resolve => require(['@/views/sys/flowchat'], resolve)
let flowInst = resolve => require(['@/components/flowchat/flowInst'], resolve)
let flow = resolve => require(['@/views/sys/flow'], resolve)
let prodtype = resolve => require(['@/views/busy/prodtype'], resolve)
let prod = resolve => require(['@/views/busy/prod'], resolve)
let partner = resolve => require(['@/views/busy/partner'], resolve)
let cust = resolve => require(['@/views/busy/cust'], resolve)
let temp = resolve => require(['@/views/busy/temp'], resolve)
let tempitem = resolve => require(['@/views/busy/tempitem'], resolve)
let preorder = resolve => require(['@/views/busy/preorder'], resolve)
let presales = resolve => require(['@/views/busy/presales'], resolve)
let order = resolve => require(['@/views/busy/order'], resolve)
let sales = resolve => require(['@/views/busy/sales'], resolve)
let orderapporve = resolve => require(['@/views/busy/orderapporve'], resolve)
let serv = resolve => require(['@/views/busy/serv'], resolve)
let service = resolve => require(['@/views/busy/service'], resolve)

let buy = resolve => require(['@/views/busy/buy'], resolve)
let buyitem = resolve => require(['@/views/busy/buyitem'], resolve)
let buyapporve = resolve => require(['@/views/busy/buyapporve'], resolve)

let Action = resolve => require(['@/views/sys/action'], resolve)
let Event = resolve => require(['@/views/sys/eventM'], resolve)
let Sin = resolve => require(['@/views/busy/sin'], resolve)
let Ins = resolve => require(['@/views/busy/ins'], resolve)
let Sout = resolve => require(['@/views/busy/sout'], resolve)
let Outs = resolve => require(['@/views/busy/outs'], resolve)

let Pay = resolve => require(['@/views/busy/pay'], resolve)
let PayItem = resolve => require(['@/views/busy/payitem'], resolve)

let receiv = resolve => require(['@/views/busy/receiv'], resolve)
let receivitem = resolve => require(['@/views/busy/receivitem'], resolve)
let Stock = resolve => require(['@/views/busy/stock'], resolve)
let InstallList = resolve => require(['@/views/busy/installlist'], resolve)



let Implement = resolve => require(['@/views/busy/implements'], resolve)
let ImplementDetail = resolve => require(['@/views/busy/implementDeatils'], resolve)
let Engineer = resolve => require(['@/views/busy/engineer'], resolve)
let SFYY = resolve => require(['@/views/busy/sfyy'], resolve)
let SFYYItem = resolve => require(['@/views/busy/sfyyitem'], resolve)
let EngineerCreate = resolve => require(['@/views/busy/engineer_create.vue'], resolve)
let EngineerDelete = resolve => require(['@/views/busy/engineer_delete.vue'], resolve)
let EngineerQuery = resolve => require(['@/views/busy/engineer_query.vue'], resolve)
let EngineerFlow = resolve => require(['@/views/busy/engineer_flow.vue'], resolve)
let EngineerApprove = resolve => require(['@/views/busy/engineer_approve.vue'], resolve)
let SfApprove = resolve => require(['@/views/busy/sfapprove.vue'], resolve)

let BussinessLog = resolve => require(['@/views/busy/bussinesslog.vue'], resolve)
let SystemLog = resolve => require(['@/views/busy/syslog.vue'], resolve)
let Appoint = resolve => require(['@/views/busy/appoint.vue'], resolve) 
let Xzgzjs = resolve => require(['@/views/busy/xzgzjs.vue'], resolve) 
let TermOfService = resolve => require(['@/views/busy/termOfService.vue'], resolve)
let MyApprove = resolve => require(['@/views/busy/sf_myapprove.vue'], resolve)


let AndroidApp = resolve => require(['@/views/sys/android_app.vue'], resolve)


let routes = [{
    path: '/login',
    name: 'login',
    component: login,
    hidden: true,
    beforeEnter: (to, from, next) => {
      // console.log(store.state)
      if (store.state.app.isLogin) {
        next('/index')
      } else {
        next()
      }
    }
  },
  {
    path: '/',
    component: Home,
    name: 'Home',
    iconCls: 'stats-bars',
    redirect: {
      path: '/index'
    },
    children: [{
        path: '/index',
        component: index,
        name: '首页',
        hidden: true
      },
      {
        path: '/userInfo',
        component: userInfo,
        name: '用户信息',
        hidden: true
      },
      {
        path: '/main',
        component: echarts,
        name: '主页',
        hidden: true
      },
      {
        path: '/vod',
        component: vod,
        name: '点播频道'
      },
      {
        path: '/livevideo',
        component: livevideo,
        name: '直播频道'
      },
      {
        path: '/history',
        component: history,
        name: '观看历史'
      },

      {
        path: '/organizationManage',
        component: organizationManage,
        name: '单位管理'
      },
      {
        path: '/userManage',
        component: userManage,
        name: '用户管理'
      },
      {
        path: '/role',
        component: role,
        name: '角色管理'
      },
      {
        path: '/roleassign',
        component: roleassign,
        name: '角色授权'
      },
      {
        path: '/resource',
        component: resource,
        name: '资源管理'
      },
      {
        path: '/logs',
        component: logs,
        name: '操作日志'
      },



      // {path: '/dashboard', component: dashboard, name: '综合分析'},
      {
        path: '/statisticsStore',
        component: statisticsStore,
        name: '存储空间'
      },
      {
        path: '/statisticsOrg',
        component: statisticsOrg,
        name: '单位统计'
      },
      {
        path: '/statisticsUser',
        component: statisticsUser,
        name: '人员统计'
      },
      {
        path: '/statisticsVideo',
        component: statisticsVideo,
        name: '视频统计'
      },
      {
        path: '/statisticsLive',
        component: statisticsLive,
        name: '直播统计'
      },

      {
        path: '/bulletin',
        component: bulletin,
        name: '公告管理'
      },
      {
        path: '/userM',
        component: userM,
        name: '人员管理'
      },
      {
        path: '/dept',
        component: dept,
        name: '部门管理'
      },
      {
        path: '/engineer',
        component: Engineer,
        name: '技术人员管理'
      },

      {
        path: '/flow',
        component: flow,
        name: '流程管理'
      },
      {
        path: '/flowchat',
        component: flowchat,
        name: '流程详情'
      },
      {
        path: '/flowInst',
        component: flowInst,
        name: '流程实例'
      },
      {
        path: '/flow',
        component: flow,
        name: '流程定义'
      },
      {
        path: '/actionM',
        component: Action,
        name: '动作管理'
      },
      {
        path: '/eventM',
        component: Event,
        name: '事件管理'
      },



      {
        path: '/liveManage',
        component: liveManage,
        name: '直播频道管理'
      },
      {
        path: '/vodManage',
        component: vodManage,
        name: '点播资源管理'
      },

      {
        path: '/prodtype',
        component: prodtype,
        name: '产品类型'
      },
      {
        path: '/prod',
        component: prod,
        name: '产品管理'
      },
      {
        path: '/partner',
        component: partner,
        name: '供应商管理'
      },
      {
        path: '/cust',
        component: cust,
        name: '客户管理'
      },
      {
        path: '/temp',
        component: temp,
        name: '订单模板'
      },
      {
        path: '/tempitem',
        component: tempitem,
        name: '订单模板明细'
      },

      {
        path: '/preorder',
        component: preorder,
        name: '商机预售'
      },
      {
        path: '/presales',
        component: presales,
        name: '商机预售明细'
      },

      {
        path: '/order',
        component: order,
        name: '销售订单'
      },
      {
        path: '/sales',
        component: sales,
        name: '销售订单明细'
      },
      {
        path: '/orderapporve',
        component: orderapporve,
        name: '销售订单审批'
      },
      {
        path: '/receiv',
        component: receiv,
        name: '销售回款'
      },
      {
        path: '/receivitem',
        component: receivitem,
        name: '回款明细'
      },


      {
        path: '/serv',
        component: serv,
        name: '服务实例'
      },
      {
        path: '/service',
        component: service,
        name: '售后服务'
      },

      {
        path: '/buy',
        component: buy,
        name: '采购订单'
      },
      {
        path: '/buyitem',
        component: buyitem,
        name: '采购订单明细'
      },
      {
        path: '/buyapporve',
        component: buyapporve,
        name: '采购订单审批'
      },

      // 入库单Sin
      {
        path: '/sin',
        component: Sin,
        name: '入库单'
      },
      {
        path: '/ins',
        component: Ins,
        name: '入库单明细'
      },
      // 出库单Sout
      {
        path: '/sout',
        component: Sout,
        name: '出库单'
      },
      {
        path: '/outs',
        component: Outs,
        name: '出库单明细'
      },

      {
        path: '/pay',
        component: Pay,
        name: '采购付款'
      },
      {
        path: '/payitem',
        component: PayItem,
        name: '付款明细'
      },
      {
        path: '/stock',
        component: Stock,
        name: '产品库存'
      },
      {
        path: '/inslist',
        component: InstallList,
        name: '安装清单'
      },

      //项目实施
      {
        path: '/implementlist',
        component: Implement,
        name: '实施记录'
      },
      {
        path: '/Implementdetail',
        component: ImplementDetail,
        name: '实施记录详情'
      },

      // 司法预约 
      {
        path: '/sfyy',
        component: SFYY,
        name: '检验预约'
      },
      {
        path: '/sf_approve',
        component: SfApprove,
        name: '司法检验审核'
      },
      {
        path: '/sf_myapprove',
        component: MyApprove,
        name: '已上报预约'
      },


      // 技术人员
      {
        path: '/engineeritem',
        component: SFYYItem,
        name: '检验预约明细'
      },
      {
        path: '/engineercreateitem',
        component: EngineerCreate,
        name: '添加技术人员明细'
      },
      {
        path: '/engineerdeleteitem',
        component: EngineerDelete,
        name: '删除技术人员明细'
      },
      {
        path: '/engineerqueryitem',
        component: EngineerQuery,
        name: '技术人员操作明细'
      },
      {
        path: '/engineer_flow',
        component: EngineerFlow,
        name: '技术人员变更'
      },
      {
        path: '/engineer_approve',
        component: EngineerApprove,
        name: '技术人员审批'
      },

      // 日志 
      {
        path: '/log_business',
        component: BussinessLog,
        name: '业务日志'
      },
      {
        path: '/log_system',
        component: SystemLog,
        name: '系统日志'
      },


      {
        path: '/appoint',
        component: Appoint,
        name: '预约统计'
      },
      {
        path: '/xzgzjs',
        component: Xzgzjs,
        name: '分县局'
      },
      {
        path: '/termOfService',
        component: TermOfService,
        name: '市局'
      },

      // app 管理
      {
        path: '/app_version',
        component: AndroidApp,
        name: 'App版本管理'
      }
    ]
  },
  {
    path: '/error404',
    name: 'error404',
    component: E404
  },
  {
    path: '*',
    redirect: '/notFound'
  },
  {
    path: '/404',
    component: notFound,
    name: '',
    hidden: true
  }
]

export default routes
